﻿<UserControl x:Class="Indigo.Quibbler.Common.ImageButton"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="Auto" Width="Auto">	
    <Button x:Name="imageButton" Cursor="Hand">
        <Button.Template>
            <ControlTemplate TargetType="{x:Type Button}">
                <Grid x:Name="grid">                
                    <Image x:Name="Image" Stretch="Uniform"/>
                    <Image x:Name="HoverImage" Stretch="Uniform">
                        <Image.Effect>
                            <DropShadowEffect Color="Gray" ShadowDepth="3"/>
                        </Image.Effect>
                    </Image>
                    </Grid>                
                <ControlTemplate.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter TargetName="Image" Property="Opacity" Value="0"/>
                        <Setter TargetName="HoverImage" Property="Opacity" Value="1"/>
                    </Trigger>
                    <Trigger Property="IsMouseOver" Value="False">
                        <Setter TargetName="Image" Property="Opacity" Value="1"/>
                        <Setter TargetName="HoverImage" Property="Opacity" Value="0"/>
                    </Trigger>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter TargetName="grid" Property="Effect" >
                            <Setter.Value>
                                <DropShadowEffect ShadowDepth="5"/>
                            </Setter.Value>
                        </Setter>
                        <Setter TargetName="grid" Property="RenderTransform" >
                            <Setter.Value>
                                <TranslateTransform Y="1.0" X="1.0"/>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                    <Trigger Property="IsEnabled" Value="false">
                        <Setter TargetName="grid" Property="Opacity" Value="0.5"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Button.Template>
    </Button>	
</UserControl>
